﻿<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>WeUI</title>
    <link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
    <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/example.css">
    <link rel="stylesheet" href="/css/magiccheck.css">
</head>
<body ontouchstart>
<script type="text/html" id="tpl_home">
</script>
<div class="container" id="container"></div>
<div class="weui-tab">
      <div class="weui-tab__bd">
        <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active" >
            <div class="refresh" style="width:100%; height:100%; overflow-y:scroll; -webkit-overflow-scrolling: touch;">
                <div class="weui-pull-to-refresh__layer">
                    <div class='weui-pull-to-refresh__arrow'></div>
                    <div class='weui-pull-to-refresh__preloader'></div>
                    <div class="down">下拉刷新</div>
                    <div class="up">释放刷新</div>
                    <div class="refresh">正在刷新</div>
                </div>
                <div class="panel">
                    <div class="weui-panel weui-panel_access">
                        <div class="weui-panel__hd height20"><div class="a_name">活动名称</div><div class="a_state">投放中</div></div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_middle"></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_middle"></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__ft height40">
                            <div class="weui-media-box weui-media-box_text weui-flex padding-top0">
                                <div class="weui-flex__item padding-top10 center"><img src="/img/baoguang.png" style="width:25px;"/>曝光次数<font> 100</font></div>
                                <div class="weui-flex__item padding-top10 center"><img src="/img/share.png" style="width:22px;"/>曝光次数<font> 10000</font></div>
                            </div>
                        </div>
                    </div>
                    <div class="weui-panel weui-panel_access">
                        <div class="weui-panel__hd height20"><div class="a_name">活动名称</div><div class="a_state">投放中</div></div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_middle"></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_middle"></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__ft height40">
                            <div class="weui-media-box weui-media-box_text weui-flex padding-top0">
                                <div class="weui-flex__item padding-top10 center"><img src="/img/baoguang.png" style="width:25px;"/>曝光次数<font> 100</font></div>
                                <div class="weui-flex__item padding-top10 center"><img src="/img/share.png" style="width:22px;"/>曝光次数<font> 10000</font></div>
                            </div>
                        </div>
                    </div>
                    <div class="weui-panel weui-panel_access">
                        <div class="weui-panel__hd height20"><div class="a_name">活动名称</div><div class="a_state">投放中</div></div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__ft height40">
                            <div class="weui-media-box weui-media-box_text weui-flex padding-top0">
                                <div class="weui-flex__item padding-top10 center"><img src="/img/baoguang.png" style="width:25px;"/>曝光次数<font> 100</font></div>
                                <div class="weui-flex__item padding-top10 center"><img src="/img/share.png" style="width:22px;"/>曝光次数<font> 10000</font></div>
                            </div>
                        </div>
                    </div>
                    <div class="weui-panel weui-panel_access">
                        <div class="weui-panel__hd height20"><div class="a_name">活动名称</div><div class="a_state">投放中</div></div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__bd">
                            <div class="weui-media-box weui-media-box_text height50">
                                <div class="a_left"><div class="money">100</div><div class="title">投放数量</div></div>
                                <div class="a_right"><div class="money">200</div><div class="title">投放金额</div></div>
                            </div>
                        </div>
                        <div class="weui-panel__ft height40">
                            <div class="weui-media-box weui-media-box_text weui-flex padding-top0">
                                <div class="weui-flex__item padding-top10 center"><img src="/img/baoguang.png" style="width:25px;"/>曝光次数<font> 100</font></div>
                                <div class="weui-flex__item padding-top10 center"><img src="/img/share.png" style="width:22px;"/>曝光次数<font> 10000</font></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="weui-loadmore">
                  <i class="weui-loading"></i>
                  <span class="weui-loadmore__tips">正在加载</span>
                </div>
            </div>
        </div>
        <div id="tab2" class="weui-tab__bd-item">
          
        </div>
        <div id="tab3" class="weui-tab__bd-item">
          <h1>页面三</h1>
        </div>
        <div id="tab4" class="weui-tab__bd-item">
          <h1>页面四</h1>
        </div>
      </div>
      <div class="weui-tabbar">
        <a href="#tab1" class="weui-tabbar__item weui-bar__item--on">
          <div class="weui-tabbar__icon">
            <img src="/img/hongbao1.png" oldsrc="/img/hongbao2.png" alt="">
          </div>
          <p id="text" class="weui-tabbar__label">活动</p>
        </a>
        <a href="#tab2" class="weui-tabbar__item">
          <div class="weui-tabbar__icon">
            <img src="/img/gift2.png" oldsrc="/img/gift2.png" alt="">
          </div>
          <p class="weui-tabbar__label">马上有礼</p>
        </a>
        <a class="weui-tabbar__item">
           <div class="addactive" id="add_active"><img src="/img/home_add.png"/><p>添加活动</p></div>
        </a>
        <a href="#tab3" class="weui-tabbar__item">
          <div class="weui-tabbar__icon">
            <img src="/img/shuju2.png" oldsrc="/img/shuju2.png" alt="">
          </div>
          <p class="weui-tabbar__label">微数据</p>
        </a>
        <a href="#tab4" class="weui-tabbar__item">
          <div class="weui-tabbar__icon">
            <img src="/img/my2.png" oldsrc="/img/my2.png" alt="">
          </div>
          <p class="weui-tabbar__label">我的</p>
        </a>
      </div>
    </div>
   
    <div class="initimg"><img src="/img/hongbao2.png"/><img src="/img/gift1.png"/><img src="/img/shuju1.png"/><img src="/img/my1.png"/></div>
    
</body>
<script src="/js/zepto.min.js"></script>
<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/jquery-weui.min.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/city-picker.min.js"></script>
<script type="text/javascript" src="/js/example.js"></script>
<script type="text/javascript" src="/js/fastclick.js"></script>
<script>
    $(".weui-tabbar a").click(function () {
        var title = $(this).find("p").html();
        document.setTitle(title);
        if (title != "添加活动") {
            var href = $(this).attr("href");
            if (href == "#tab1") {
                $(this).find("img").attr("src", "/img/hongbao1.png");
            }
            else if (href == "#tab2") {
                $(this).find("img").attr("src", "/img/gift1.png");
            }
            else if (href == "#tab3") {
                $(this).find("img").attr("src", "/img/shuju1.png");
            }
            else if (href == "#tab4") {
                $(this).find("img").attr("src", "/img/my1.png");
            }
            var imgs = $(this).siblings().find("img");
            $.each(imgs, function (i, info) {
                $(this).attr("src", $(this).attr("oldsrc"));
            });
        }
    });

    document.setTitle = function(t) {
        document.title = t;
        var i = document.createElement('iframe');
        i.src = '/img/dian.gif';
        i.style.display = 'none';
        i.onload = function() {
          setTimeout(function(){
            i.remove();
          }, 9)
        }
        document.body.appendChild(i);
    }
    $(function () {
        
        FastClick.attach(document.body);
        $("#add_active").on('click', function () {
            window.pageManager.go("add_active");
        });
        $(".refresh").pullToRefresh().on("pull-to-refresh", function () {
            var self = this;
            setTimeout(function () {
                //$("#time").text(new Date);
                $(self).pullToRefreshDone();
            }, 2000);
        });
        $(".refresh").infinite($(".refresh").height() - $(window).height() + 50).on("infinite", function () {
            var self = this;
            if (self.loading) return;
            self.loading = true;
            setTimeout(function () {
                self.loading = false;
            }, 1000);

        });

    });
        function Select_HongBao() {
            window.pageManager.go("select_hongbao");
            setTimeout(function () {
                var type = $("#hongbaoguize").attr("type");
                var count = $("#hongbaoguize").attr("count");
                var money = $("#hongbaoguize").attr("money");
                if (type == "1" || type=="") {
                    $("#hong1,#hong2").removeClass("hidden");
                    $("#hong3,#hong4").addClass("hidden");
                    $("#hong1 .weui-input").val(count);
                    $("#hong2 .weui-input").val(money);
                    $("#hongbao1").prop("checked", true);
                } else {
                    $("#hong1,#hong2").addClass("hidden");
                    $("#hong3,#hong4").removeClass("hidden");
                    $("#hong3 .weui-input").val(count);
                    $("#hong4 .weui-input").val(money);
                    $("#hongbao2").prop("checked", true);
                }
            }, 10);

        };
        function Select_HuoDong() {
            window.pageManager.go("add_huodong");
        };
        function Select_Range() {
            window.pageManager.go("add_range");
            setTimeout(function () {
                $("#citys5").cityPicker({
                    title: "请选择收货地址"
                });
            }, 1000);
        };
        function Select_ChuanBo() {
            $.actions({
                title: "领奖设置",
                actions: [{
                    text: "无需传播，直接领奖",
                    onClick: function () {
                        $("#pengyouquan").html("无需传播，直接领奖");
                    }
                }, {
                    text: "分享活动详情后领奖",
                    onClick: function () {
                        $("#pengyouquan").html("分享活动详情后领奖");
                    }
                }, {
                    text: "分享指定图文后领奖",
                    onClick: function () {
                        $("#pengyouquan").html("分享指定图文后领奖");
                    }
                }]
            });
        };
        function HongBao_Radio() {
            if ($("input[name='active_hongbao']:checked").val() == "1") {
                $("#hong1,#hong2").removeClass("hidden");
                $("#hong3,#hong4").addClass("hidden");
            } else {
                $("#hong1,#hong2").addClass("hidden");
                $("#hong3,#hong4").removeClass("hidden");
            }
        };
        function Range_Radio() {
            if ($("input[name='active_range']:checked").val() == "1") {
                $("#director,#position").addClass("hidden");
            } else {
                $("#director,#position").removeClass("hidden");
            }
        };
        function Finish_HongBao() {
            var type = $("input[name='active_hongbao']:checked").val();
            if (type == 1) {
                $("#hongbaoguize").html($("#hong1 .weui-input").val() + "个").attr("count", $("#hong1 .weui-input").val()).attr("type", type).attr("money", $("#hong2 .weui-input").val());
            } else {
                $("#hongbaoguize").html($("#hong3 .weui-input").val() + "个").attr("count", $("#hong3 .weui-input").val()).attr("type", type).attr("money", $("#hong4 .weui-input").val());
            }
            Back();
        };
        function Open_Address() {
            wx.openLocation({
                latitude: 0, // 纬度，浮点数，范围为90 ~ -90
                longitude: 0, // 经度，浮点数，范围为180 ~ -180。
                name: '', // 位置名
                address: '', // 地址详情说明
                scale: 1, // 地图缩放级别,整形值,范围从1~28。默认为最大
                infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
            });
        };
        function Finish_HuoDong() {
            Back();
        };
        function Finish_Range() {
            Back();
        };
        function Back() {
            window.history.go(-1);
        };
</script>

<script type="text/html" id="tpl_add_active">
<div class="page">
<div class="page__bd">
<div class="weui-cells weui-cells_form">
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">活动状态</label></div>
    <div class="weui-cell__bd">
          <div class="float" style="padding-right:20px;">
          <input type="radio" class="magic-radio" name="active_state" id="active_state1" checked="checked" />
          <label for="active_state1">启动</label>
          </div>
          <div class="float" style="font-size:16px;">
          <input type="radio" class="magic-radio" name="active_state" id="active_state2" checked="checked" />
          <label for="active_state2">关闭</label>
          </div>
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">活动名称</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input" type="text" placeholder="请输入活动名称">
    </div>
  </div>
  <a class="weui-cell weui-cell_access" href="javascript:Select_HongBao()">
      <div class="weui-cell__bd">
           <p>红包规则</p>
      </div>
      <div id="hongbaoguize" class="weui-cell__ft" style="font-size:16px;" type="" count="" money="">请选择</div>
  </a>
  <a class="weui-cell weui-cell_access" href="javascript:Select_HuoDong()">
      <div class="weui-cell__bd">
           <p>活动详情</p>
      </div>
      <div class="weui-cell__ft" style="font-size:16px;">点击进入</div>
  </a>
  <a class="weui-cell weui-cell_access" href="javascript:Select_ChuanBo()">
      <div class="weui-cell__bd">
           <p>朋友圈传播</p>
      </div>
      <div id="pengyouquan" class="weui-cell__ft" style="font-size:16px;">请选择</div>
  </a>
  <a class="weui-cell weui-cell_access" href="javascript:Select_Range()">
      <div class="weui-cell__bd">
           <p>投放范围</p>
      </div>
      <div class="weui-cell__ft" style="font-size:16px;">请选择</div>
  </a>
</div>
</div>
</div>
</script>
<script type="text/html" id="tpl_select_hongbao">
<div class="page">
<div class="page__bd">
<div class="weui-cells weui-cells_checkbox">
      <label class="weui-cell weui-check__label" for="hongbao1" onclick="HongBao_Radio()">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_hongbao" id="hongbao1" checked="checked" value="1"/>
          <label for="hongbao1">随机红包</label>
        </div>
      </label>
      <div id="hong1" class="weui-cell">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;红包个数</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入红包个数" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          个
        </div>
      </div>
      <div id="hong2" class="weui-cell">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总金额</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入总金额" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          元
        </div>
      </div>
      <label class="weui-cell weui-check__label" for="hongbao2" onclick="HongBao_Radio()">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_hongbao" id="hongbao2" value="2"/>
          <label for="hongbao2">指定红包</label>
        </div>
      </label>
      <div id="hong3" class="weui-cell hidden">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;红包个数</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入红包个数" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          个
        </div>
      </div>
      <div id="hong4" class="weui-cell hidden">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单个金额</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入单个金额" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          元
        </div>
      </div>
    </div>
    <div class="button">
    <a href="javascript:Finish_HongBao()" class="weui-btn weui-btn_primary">确定</a>
    </div>
</div>
</div>
</script>
<script type="text/html" id="tpl_add_huodong">
<div class="page">
<div class="page__bd">
<div class="weui-cells">
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">活动名称</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input" type="text" placeholder="请输入活动名称">
    </div>
  </div>
</div>
<div class="weui-cells" style="margin-top:10px;">
  <div class="activeimg">图片</div>
  <div class="activeupload"><div class="heng"></div><div class="shu"></div></div>
</div>
<div class="weui-cells" style="margin-top:10px;">
  <div class="activeimg">文字</div>
  <div class="activetext"><textarea placeholder="输入活动介绍"></textarea></div>
</div>
<div class="button">
    <a href="javascript:Finish_HuoDong()" class="weui-btn weui-btn_primary">确定</a>
</div>
</div>
</div>
</script>
<script type="text/html" id="tpl_add_range">
<div class="page">
<div class="page__bd">
<div class="weui-cells weui-cells_checkbox">
      <div class="weui-cell weui-check__label weui-cell_access" onclick="Range_Radio();">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_range" id="range1" checked="checked" value="1"/>
          <label for="range1">选择地区</label>
        </div>
        <div class="weui-cell__bd"></div>
        <div class="weui-cell__ft" id="citys5">请选择</div>
      </div>
      <label class="weui-cell weui-check__label" for="range2" onclick="Range_Radio()">
        <div class="weui-cell__hd">
          <input type="radio" class="magic-radio" name="active_range" id="range2" value="2"/>
          <label for="range2">指定范围</label>
        </div>
      </label>
      <div id="position" class="weui-cell weui-cell_access hidden" onclick="Open_Address()">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;投放位置</label></div>
        <div class="weui-cell__bd">
        </div>
        <div class="weui-cell__ft">
           请选择
        </div>
      </div>
      <div id="director" class="weui-cell hidden">
        <div class="weui-cell__hd"><label for="" class="weui-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;投放半径</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input txtright padding-right10" type="number" value="" placeholder="请输入距离" style="width:95%;">
        </div>
        <div class="weui-cell__ft">
          米以内
        </div>
      </div>
    </div>
    <div class="button">
    <a href="javascript:Finish_Range()" class="weui-btn weui-btn_primary">确定</a>
    </div>
</div>
</div>
</script>
</html>
